﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Resources;

namespace spktNhom4DoAnCuoiKy
{
    public partial class UserInterface : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            //create menu
            ResourceManager rm = new ResourceManager("Resources.String", System.Reflection.Assembly.Load("App_GlobalResources"));
            AuctionOnlineDataContext db = new AuctionOnlineDataContext();
            string str="";
            str += " <div class='cssmenu'>";
           str+=" <ul>";
            //nhóm phiên
           str += String.Format("<li class='active'><a href='{0}'><span>{1}</span></a></li>", "#", rm.GetString("ui_NhomPhien"));
           foreach (var item in db.NhomPhiens.ToList())
           {
               str += String.Format("<li><a href='{0}'><span>{1}</span></a></li>", "#", rm.GetString(item.TenNhomPhien));
           }
           str += String.Format("<li class='active'><a href='{0}'><span>{1}</span></a></li>", "#", rm.GetString("ui_LoaiPhien"));
           int cout = db.LoaiPhiens.Count();
           int i = 0;
            foreach (var item in db.LoaiPhiens.ToList())
           {
               if (i==cout-1)
                   str += String.Format("<li class='last'><a href='{0}'><span>{1}</span></a></li>", "#", rm.GetString(item.TenLoaiPhien));
               else
               str += String.Format("<li><a href='{0}'><span>{1}</span></a></li>", "#", rm.GetString(item.TenLoaiPhien));
               i++;

           }
            
            str+="</ul>";
            str += "</div>";
            lblvmenu.Text = str;
        }

        protected void BackgroundTimer_Tick(object sender, EventArgs e)
        {
            if (Session.HasMessage())
            {
                if (Session.getRecipients() == Session["tung"].ToString())
                {
                    lblThongBaoKetQua.Text = Session.getMessages();
                    Button1_ModalPopupExtender.Show();
                    Session.InformReicevedMessages();
                }
            }
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
           
        }
    }
}